package com.eaoa.uc.publog.bo;

import java.util.Date;

import com.eaoa.base.EABaseBusinessObject;
import com.eaoa.dao.pub.PubBilllogDAO;
import com.eaoa.vo.pub.PubBilllog;

public class PubBilllogSaveBO extends EABaseBusinessObject{
	
	private PubBilllog billlog;
	private static PubBilllogDAO billogDAO = new PubBilllogDAO();
	
	private Long billno;
	private String billtype;
	private String logtype;
	private String context;
	private String isshow;
	
	public PubBilllogSaveBO(PubBilllog billlog){
		super();
		this.billlog = billlog;
	}
	
	public PubBilllogSaveBO(Long billno, String billtype, String logtype, String context, String isshow){
		super();
		this.billno = billno;
		this.billtype = billtype;
		this.logtype = logtype;
		this.context = context;
		this.isshow = isshow;
	}
	

	protected void performBusinessLogic() {
		
		if(billlog==null){
			billlog = new PubBilllog();
			billlog.setBillno(billno);
			billlog.setBilltype(billtype);
			billlog.setLogtype(logtype);
			billlog.setContext(context);
			billlog.setIsshow(isshow);
		}

		billlog.setUserno(getEmployee().getAccountno());
		billlog.setUsername(getEmployee().getName());
		billlog.setCreatedate(new Date());
		billogDAO.save(billlog);
	}
	
}